<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组的find方法</title>
    <script>

        let arr = [1, 2, 3, 4, 5, 6, 7];

        //find依旧会遍历数组，element表示当前的元素
        //箭头函数的内容表示筛选的规则，如果规则为true则返回当前的元素
        let result = arr.find(element => element === 7);

        let users = [
            {
                id: 10010,
                mame: "刘德华",
                age: 50
            },
            {
                id: 10011,
                mame: "刘德华",
                age: 51
            },
            {
                id: 10012,
                mame: "刘德华",
                age: 52
            },
            {
                id: 10013,
                mame: "刘德华",
                age: 53
            },
            {
                id: 10014,
                mame: "刘德华",
                age: 54
            }
        ];



       let userResult = users.find(user=>user.id===10013)


        console.log(userResult)

    </script>
</head>
<body>

</body>
</html>